package stream;

import sun.net.TelnetOutputStream;

import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;
import java.io.*;

public class demo {
    int i = -2147483648;

    public static void generateCharacters(OutputStream out) throws IOException {
        int firstPrintableCharacer = 33;
        int numberOfPrintableCharacters = 94;
        int numberOfCharactersPerLine = 72;

        int start = firstPrintableCharacer;
        while (true){/*无限循环*/
            for (int i = start; i < start +numberOfCharactersPerLine; i++) {
                out.write((
                        (i - firstPrintableCharacer) % numberOfPrintableCharacters)
                 + firstPrintableCharacer);
            }
            out.write('\r');
            out.write('\n');
            start = ((start + 1) - firstPrintableCharacer)
                    % numberOfPrintableCharacters + firstPrintableCharacer;

        }

    }

    public static void main(String[] args) {
        JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
        int result = javaCompiler.run(null,null,null,"-sourcepath","src","G:\\files\\zkr_micro_daily\\Core-Java\\reader\\src\\main\\java\\stream\\demo.java");
        System.out.println(result);

    }

}
